package com.quanjiaolian.chat.servlet;

import java.io.IOException;
import java.util.HashMap;
import java.util.Map;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.quanjiaolian.chat.service.ChatService;
import com.quanjiaolian.chat.serviceimpl.ChatServiceImpl;
import com.quanjiaolian.tools.ResponseToJson;

/**
 * 处理用户点赞请求
 * @author Herson_Li
 *
 */
@SuppressWarnings("serial")
public class PointLike extends HttpServlet {

	
	public void doGet(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		
		ChatService cs = new ChatServiceImpl();
		Map<String,Object> resultMap = new HashMap<String,Object>();
		String chat_id = request.getParameter("chat_id");//得到新鲜事ID
		if(chat_id == null){
			resultMap.put("result","Error");
			ResponseToJson.responseOutWithJson(response,resultMap);
		}else{
			resultMap = cs.updatePraiseByChatId(Integer.parseInt(chat_id));
			ResponseToJson.responseOutWithJson(response,resultMap);
		}
		
	}

	public void doPost(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {

		this.doGet(request, response);
	}

}
